package com.wuiy.activity;

import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

import com.wuiy.fragment.ContactFragment;
import com.wuiy.fragment.FindFragment;
import com.wuiy.fragment.MeFragment;
import com.wuiy.fragment.WeChatFragment;
import com.wuiy.wechat.R;

public class MainActivity extends AppCompatActivity {
    private FragmentManager mFragmentManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mFragmentManager = getFragmentManager();
    }

    public void weChat(View view) {
        FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.contentTv, new WeChatFragment());
        fragmentTransaction.commit();
    }

    public void contact(View view) {
        FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.contentTv, new ContactFragment());
        fragmentTransaction.commit();
    }

    public void find(View view) {
        FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.contentTv, new FindFragment());
        fragmentTransaction.commit();
    }

    public void me(View view) {
        FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.contentTv, new MeFragment());
        fragmentTransaction.commit();
    }
}
